unit Con_Feriado;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Formulario_Padrao_Consulta, Grids, DBGrids, StdCtrls, Buttons, ExtCtrls,
  Db, DbTables, TFlatButtonUnit;

type
  TFrmCon_Feriado = class(TFrmConsulta)
    dbgFeriado: TDBGrid;
    procedure BtnFecharClick(Sender: TObject);
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
    procedure FazConsulta;
  public
    { Public declarations }
    Fer_Data: string;
  end;

var
  FrmCon_Feriado: TFrmCon_Feriado;

implementation
uses Dm, Biblio, clsFeriado;

{$R *.DFM}

var
  Feriado: TFeriado;
  tds: Tdatasource;
  tq: Tquery;

procedure TFrmCon_Feriado.BtnFecharClick(Sender: TObject);
begin
  inherited;
  Fer_Data := tq.fieldbyname('Fer_Data').asstring;
  tds.free;
  tq.free;
end;

procedure TFrmCon_Feriado.FormActivate(Sender: TObject);
begin
  inherited;
  tds := TDataSource.create(FrmCon_Feriado);
  tq := Tquery.create(FrmCon_Feriado);
  tq.databasename := dmint.db.databasename;
  tq.active := False;
  tds.DataSet := tq;
  fazconsulta;
end;

procedure TfrmCon_Feriado.FazConsulta;
begin
  Feriado := TFeriado.Create;
  Feriado.Consultar(tq);
  tq.open;
  Feriado.free;
  dbgFeriado.DataSource := tds;
  dbgFeriado.Refresh;
end;

end.
